From 4142fe1d1fbb479d25f53b319f9ff584ded06b9c Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Thu, 23 Nov 2006 17:37:23 +0000 Subject: [PATCH] [XEN] Small ioemul cleanup. Signed-off-by: Keir Fraser --- xen/arch/x86/traps.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 120179d640..87f3f79491 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -1046,8 +1046,7 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0; unsigned int port, i, op_bytes = 4, data, rc; char io_emul_stub[16]; - void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1))) \ - = (void*)&io_emul_stub[0]; + void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1))); u32 l, h; /* Legacy prefixes. */ @@ -1190,6 +1189,9 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) *(s32 *)&io_emul_stub[9] = (char *)guest_to_host_gpr_switch - &io_emul_stub[13]; + /* Handy function-typed pointer to the stub. */ + io_emul = (void *)io_emul_stub; + /* I/O Port and Interrupt Flag instructions. */ switch ( opcode ) { @@ -1207,13 +1209,13 @@ static int emulate_privileged_op(struct cpu_user_regs *regs) if ( guest_inb_okay(port, v, regs) ) io_emul(regs); else - regs->eax = (regs->eax & ~0xffUL) | (u8)~0; + regs->eax |= (u8)~0; break; case 2: if ( guest_inw_okay(port, v, regs) ) io_emul(regs); else - regs->eax = (regs->eax & ~0xffffUL) | (u16)~0; + regs->eax |= (u16)~0; break; case 4: if ( guest_inl_okay(port, v, regs) ) -- 2.30.2